/**
 * 测试页面
 */

const app = getApp();

Page({
  data: {
    testData: '加载数据',
    newsdata: ''
  },
  onLoad: function(){
    console.log('Test页面加载')
  },
  onShow: function(){
    console.log('Test页面显示')
  },
  loadData: function(){
    let that = this;
    console.log('loadData')
    wx.request({
      url: 'https://newsapi.gugujiankong.com/Handler.ashx?action=getnews&type=top&count=10', 
      header: {
        'content-type': 'application/json' // 默认值
      },
      success: function (res) {
        console.log(res.data)
        that.newsdata = res.data;
        console.log("res:",that.newsdata)
      }
    })
  }
})


